package collection;

import java.util.*;

public class MyArrList {
    public class Node{
        String name;
        int age;
    }
    public static void main(String args[]){
        ArrayList<Integer> arr=new ArrayList<Integer>();
        arr.add(8);
        arr.add(9);
        arr.add(5);
        arr.add(18);
        for(int i=0;i<arr.size();i++){
            System.out.print(arr.get(i)+" ");
        }
        System.out.println();
        Collections.sort(arr, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return 02-01;
            }
        });
        Iterator<Integer>it=arr.iterator();
        while(it.hasNext()){
            System.out.print(it.next()+" ");
        }
        System.out.println();

        for(Integer ar:arr){
            System.out.print(ar+" ");
        }
        System.out.println();

        ArrayList<Node>arr1=new ArrayList<Node>(2);
    }
}